<%-- 
    Document   : StartShopping
    Created on : Apr 23, 2009, 8:42:16 PM
    Author     : dale

    Welcome page for the Store
--%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<%@page contentType="text/html" pageEncoding="UTF-8" import="store.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<f:view>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Let's Go Shopping with JSF</title>
    </head>
    <body BGCOLOR="#FFFFFF" TEXT="#000000">
        <font FACE=VERDANA></font>
        <center>
        <H2>Welcome to the Store</H2>
        <h3>Please press the button to enter the store</h3>

        <%
          // Somehow need this to get the static constructor to work
          // but only create a singleton object for entire web app
          if (application.getAttribute("store") == null) {
            application.setAttribute("store", new ShopInventory());
          }

          // We use multiple pages for displaying the items, 
          // Each customer has their own session object
          session.setAttribute ("itemsPerPage", new Integer(4));
        %>
        
        <h:form id="loginForm">
            <h:outputText value="Your Name: " />
            <h:inputText id="name" value="#{customerBean.name}" />
            <br/>
            
            <h:outputText value="Your Address: " />
            <h:inputText id="address" value="#{customerBean.address}" />
            <br/>
            
            <h:inputHidden id="itemNumber" value="0" />
            <h:commandButton id="submit" value="Start Shopping" action="success" />
        </h:form>
    </body>
</html>
</f:view>